//2009/10/17 15:20:10
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class StrangeComputer
{
public:
    int setMemory(string mem)
    {
        int count = 0;
        bool flag = false;
        for (int i=0; i<mem.size(); i++)
        {
            if (mem[i]=='1' && !flag)
            {
                count++;
                flag = true;
            }
            else if (mem[i]=='0' && flag)
            {
                count++;
                flag = false;
            }
        }
        return count;
    }
};
